<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateWeixinUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('weixin_users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('openid')->notNull()->default('')->comment('用户在公众号的openID');
            $table->string('nickname')->notNull()->default('')->comment('用户昵称');
            $table->tinyInteger('sex')->notNull()->default(0)->comment('性别 0未知 1男 2女');
            $table->string('province')->notNull()->default('')->comment('省');
            $table->string('city')->notNull()->default('')->comment('市');
            $table->string('country')->notNull()->default('')->comment('国家');
            $table->string('headimgurl')->notNull()->default('')->comment('头像');
            $table->string('language')->notNull()->default('')->comment('语言');
            $table->string('privilege')->notNull()->default('')->comment('权限');
            $table->string('unionid')->notNull()->default('')->comment('只有在用户将公众号绑定到微信开放平台帐号后，才会出现该字段');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('weixin_users');
    }
}
